<!DOCTYPE html>
<html>
<head>
  <title>IGraphClientBuilder.java</title>
  <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>
  <link rel='stylesheet' type='text/css' href='../../../../../coverage.css'/>
  <link rel='shortcut icon' type='image/png' href='../../../../../logo.png'/>
  <script type='text/javascript' src='../../../../../coverage.js'></script>
  <script type='text/javascript' src='../../../../../prettify.js'></script>
</head>
<body onload='prettyPrint()'>
  <table cellpadding='0' cellspacing='1'>
    <caption>igraph_client_java/src/main/java/com/taobao/igraph/client/core/IGraphClientBuilder.java</caption>
    <tr>
      <td class='line'>1</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>package com.taobao.igraph.client.core;</pre></td>
    </tr>
    <tr><td class='line'></td><td colspan='2'>&nbsp;</td></tr>
    <tr>
      <td class='line'></td><td>&nbsp;</td>
      <td><pre class='imports prettyprint' onclick='showHideLines(this)'><div>import com.taobao.diamond.client.Diamond;
import com.taobao.igraph.client.common.DiamondConfigManager;
import com.taobao.igraph.client.common.IGraphClientException;
import com.taobao.igraph.client.config.IGraphClientConfig;
import com.taobao.igraph.client.config.IGraphRequesterConfig;
import com.taobao.igraph.client.core.model.Type;
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;

import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.concurrent.atomic.AtomicBoolean;
</div><span>import ...</span></pre></td>
    </tr>
    <tr><td class='line'></td><td colspan='2'>&nbsp;</td></tr>
    <tr>
      <td class='line'>17</td><td class='count'>1</td>
      <td><pre class='prettyprint covered' id='l17s0'>@Slf4j</pre></td>
    </tr>
    <tr>
      <td class='line'>18</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>public class IGraphClientBuilder {</pre></td>
    </tr>
    <tr>
      <td class='line'>19</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    private static final String DEFAULT_IP = "igraph_client_invalid_ip";</pre></td>
    </tr>
    <tr>
      <td class='line'>20</td><td class='count'>1</td>
      <td><pre class='prettyprint covered' id='l20s0'>    private IGraphRequesterConfig requesterConfig = new IGraphRequesterConfig();</pre></td>
    </tr>
    <tr>
      <td class='line'>21</td><td class='count'>1</td>
      <td><pre class='prettyprint covered' id='l21s0'>    private IGraphClientConfig clientConfig = new IGraphClientConfig();</pre></td>
    </tr>
    <tr>
      <td class='line'>22</td><td class='count'>1</td>
      <td><pre class='prettyprint covered' id='l22s0'>    private IGraphRequester requester = new RequestSenderProxy();</pre></td>
    </tr>
    <tr>
      <td class='line'>23</td><td class='count'>1</td>
      <td><pre class='prettyprint covered' id='l23s0'>    private AtomicBoolean isRequesterInitialized = new AtomicBoolean(false);</pre></td>
    </tr>
    <tr><td class='line'></td><td colspan='2'>&nbsp;</td></tr>
    <tr>
      <td class='line'>25</td><td class='count'>1</td>
      <td><pre class='prettyprint covered' id='l25s0'>    private IGraphClientBuilder() {</pre></td>
    </tr>
    <tr>
      <td class='line'>26</td><td class='count'>1</td>
      <td><pre class='prettyprint covered' id='l26s0'>    }</pre></td>
    </tr>
    <tr><td class='line'></td><td colspan='2'>&nbsp;</td></tr>
    <tr>
      <td class='line'></td><td>&nbsp;</td>
      <td class='comment' onclick='showHideLines(this)'><div>    /**
     * 每个builder拥有一份独立的配置 通过这个builder build得到的client共享一个Searcher
     */</div><span>    /*...*/</span></td>
    </tr>
    <tr>
      <td class='line'>31</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    public static IGraphClientBuilder create() {</pre></td>
    </tr>
    <tr>
      <td class='line'>32</td><td class='count'>1</td>
      <td><pre class='prettyprint covered' id='l32s0'>        return new IGraphClientBuilder();</pre></td>
    </tr>
    <tr>
      <td class='line'>33</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    }</pre></td>
    </tr>
    <tr><td class='line'></td><td colspan='2'>&nbsp;</td></tr>
    <tr>
      <td class='line'>35</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    private static String getIntranetIp() {</pre></td>
    </tr>
    <tr>
      <td class='line'>36</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>        String localAddress;</pre></td>
    </tr>
    <tr>
      <td class='line'>37</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>        try {</pre></td>
    </tr>
    <tr>
      <td class='line'>38</td><td class='count'>1</td>
      <td><pre class='prettyprint covered' id='l38s0'>            localAddress = InetAddress.getLocalHost().getHostAddress();</pre></td>
    </tr>
    <tr>
      <td class='line'>39</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l39s0'>        } catch (UnknownHostException e) {</pre></td>
    </tr>
    <tr>
      <td class='line'>40</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l40s0'>            log.error("getLocalHost failed", e);</pre></td>
    </tr>
    <tr>
      <td class='line'>41</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l41s0'>            localAddress = DEFAULT_IP;</pre></td>
    </tr>
    <tr>
      <td class='line'>42</td><td class='count'>1</td>
      <td><pre class='prettyprint covered' id='l42s0'>        }</pre></td>
    </tr>
    <tr>
      <td class='line'>43</td><td class='count'>1</td>
      <td><pre class='prettyprint jmp'>        <span id='l43s0' title='Executions: 1' class='covered'>if (localAddress == null)</span> {</pre></td>
    </tr>
    <tr>
      <td class='line'>44</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l44s0'>            log.error("get empty localAddress");</pre></td>
    </tr>
    <tr>
      <td class='line'>45</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l45s0'>            localAddress = DEFAULT_IP;</pre></td>
    </tr>
    <tr>
      <td class='line'>46</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>        }</pre></td>
    </tr>
    <tr>
      <td class='line'>47</td><td class='count'>1</td>
      <td><pre class='prettyprint covered' id='l47s0'>        return localAddress;</pre></td>
    </tr>
    <tr>
      <td class='line'>48</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    }</pre></td>
    </tr>
    <tr><td class='line'></td><td colspan='2'>&nbsp;</td></tr>
    <tr>
      <td class='line'></td><td>&nbsp;</td>
      <td class='comment' onclick='showHideLines(this)'><div>    /**
     * 构造一个IGraphClient&lt;br/>
     * 其中，VIPServer相关配置会从diamond中读取
     * 
     * @param src
     *            请求调用者的名称
     * @return 构造的client
     */</div><span>    /*...*/</span></td>
    </tr>
    <tr>
      <td class='line'>58</td><td class='count'>1</td>
      <td><pre class='prettyprint jmp'>    <span id='l58s0' title='Executions: 1' class='covered'>public IGraphClient build(@NonNull String src) {</span></pre></td>
    </tr>
    <tr>
      <td class='line'>59</td><td class='count'>1</td>
      <td><pre class='prettyprint covered' id='l59s0'>        return buildImpl(src, null, null);</pre></td>
    </tr>
    <tr>
      <td class='line'>60</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    }</pre></td>
    </tr>
    <tr><td class='line'></td><td colspan='2'>&nbsp;</td></tr>
    <tr>
      <td class='line'></td><td>&nbsp;</td>
      <td class='comment' onclick='showHideLines(this)'><div>    /**
     * 构造一个IGraphClient&lt;br/>
     * 其中，VIPServer相关配置使用用户指定的配置
     *
     * @param src
     *            请求调用者的名称
     * @param searchDomain
     *            查询服务的VIPServer Domain
     * @param updateDomain
     *            更新服务的VIPServer Domain
     * @return 构造的client
     */</div><span>    /*...*/</span></td>
    </tr>
    <tr>
      <td class='line'>74</td><td class='count'>0</td>
      <td><pre class='prettyprint jmp'>    <span id='l74s0' title='Executions: 0' class='uncovered'>public IGraphClient build(@NonNull String src, @NonNull String searchDomain, @NonNull String updateDomain) {</span></pre></td>
    </tr>
    <tr>
      <td class='line'>75</td><td class='count'>0</td>
      <td><pre class='prettyprint jmp'>        <span id='l75s0' title='Executions: 0' class='uncovered'>if (src.isEmpty()</span> || <span id='l75s1' title='Executions: 0' class='uncovered'>searchDomain.isEmpty()</span> || <span id='l75s2' title='Executions: 0' class='uncovered'>updateDomain.isEmpty())</span> {</pre></td>
    </tr>
    <tr>
      <td class='line'>76</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l76s0'>            throw new IGraphClientException("Failed to build IGraphClient with invalid args:[src:[" + src</pre></td>
    </tr>
    <tr>
      <td class='line'>77</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>                    + "], searchDomain:[" + searchDomain + "], updateDomain:[" + updateDomain + "]]");</pre></td>
    </tr>
    <tr>
      <td class='line'>78</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>        }</pre></td>
    </tr>
    <tr>
      <td class='line'>79</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l79s0'>        return buildImpl(src, searchDomain, updateDomain);</pre></td>
    </tr>
    <tr>
      <td class='line'>80</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    }</pre></td>
    </tr>
    <tr><td class='line'></td><td colspan='2'>&nbsp;</td></tr>
    <tr>
      <td class='line'>82</td><td>&nbsp;</td>
      <td><pre class='comment'>    /** @Deprecated use {@link #build(String, String, String)} instead */</pre></td>
    </tr>
    <tr>
      <td class='line'>83</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    @Deprecated</pre></td>
    </tr>
    <tr>
      <td class='line'>84</td><td class='count'>0</td>
      <td><pre class='prettyprint jmp'>    <span id='l84s0' title='Executions: 0' class='uncovered'>public IGraphClient build(@NonNull String src, @NonNull String searchDomain) {</span></pre></td>
    </tr>
    <tr>
      <td class='line'>85</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l85s0'>        return build(src, searchDomain, (Type) null);</pre></td>
    </tr>
    <tr>
      <td class='line'>86</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    }</pre></td>
    </tr>
    <tr><td class='line'></td><td colspan='2'>&nbsp;</td></tr>
    <tr>
      <td class='line'>88</td><td>&nbsp;</td>
      <td><pre class='comment'>    /** @Deprecated use {@link #build(String, String, String)} instead */</pre></td>
    </tr>
    <tr>
      <td class='line'>89</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    @Deprecated</pre></td>
    </tr>
    <tr>
      <td class='line'>90</td><td class='count'>0</td>
      <td><pre class='prettyprint jmp'>    <span id='l90s0' title='Executions: 0' class='uncovered'>public IGraphClient build(@NonNull String src, String searchDomain, Type type) {</span></pre></td>
    </tr>
    <tr>
      <td class='line'>91</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l91s0'>        return buildImpl(src, searchDomain, null);</pre></td>
    </tr>
    <tr>
      <td class='line'>92</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    }</pre></td>
    </tr>
    <tr><td class='line'></td><td colspan='2'>&nbsp;</td></tr>
    <tr>
      <td class='line'>94</td><td>&nbsp;</td>
      <td><pre class='comment'>    /** @Deprecated use {@link IGraphClient#close()} instead */</pre></td>
    </tr>
    <tr>
      <td class='line'>95</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    @Deprecated</pre></td>
    </tr>
    <tr>
      <td class='line'>96</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    public void close() {</pre></td>
    </tr>
    <tr>
      <td class='line'>97</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l97s0'>        requester.close();</pre></td>
    </tr>
    <tr>
      <td class='line'>98</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l98s0'>    }</pre></td>
    </tr>
    <tr><td class='line'></td><td colspan='2'>&nbsp;</td></tr>
    <tr>
      <td class='line'>100</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    public void setSocketTimeout(int socketTimeout) {</pre></td>
    </tr>
    <tr>
      <td class='line'>101</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l101s0'>        requesterConfig.getHttpConnectionConfig().setSocketTimeout(socketTimeout);</pre></td>
    </tr>
    <tr>
      <td class='line'>102</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l102s0'>    }</pre></td>
    </tr>
    <tr><td class='line'></td><td colspan='2'>&nbsp;</td></tr>
    <tr>
      <td class='line'>104</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    public void setConnectTimeout(int connectTimeout) {</pre></td>
    </tr>
    <tr>
      <td class='line'>105</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l105s0'>        requesterConfig.getHttpConnectionConfig().setConnectTimeout(connectTimeout);</pre></td>
    </tr>
    <tr>
      <td class='line'>106</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l106s0'>    }</pre></td>
    </tr>
    <tr><td class='line'></td><td colspan='2'>&nbsp;</td></tr>
    <tr>
      <td class='line'>108</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    public void setConnectionRequestTimeout(int connectionRequestTimeout) {</pre></td>
    </tr>
    <tr>
      <td class='line'>109</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l109s0'>        requesterConfig.getHttpConnectionConfig().setConnectionRequestTimeout(connectionRequestTimeout);</pre></td>
    </tr>
    <tr>
      <td class='line'>110</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l110s0'>    }</pre></td>
    </tr>
    <tr><td class='line'></td><td colspan='2'>&nbsp;</td></tr>
    <tr>
      <td class='line'>112</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    public void setMaxConnTotal(int maxConnTotal) {</pre></td>
    </tr>
    <tr>
      <td class='line'>113</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l113s0'>        requesterConfig.setMaxConnTotal(maxConnTotal);</pre></td>
    </tr>
    <tr>
      <td class='line'>114</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l114s0'>    }</pre></td>
    </tr>
    <tr><td class='line'></td><td colspan='2'>&nbsp;</td></tr>
    <tr>
      <td class='line'>116</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    public void setMaxConnPerRoute(int maxConnPerRoute) {</pre></td>
    </tr>
    <tr>
      <td class='line'>117</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l117s0'>        requesterConfig.setMaxConnPerRoute(maxConnPerRoute);</pre></td>
    </tr>
    <tr>
      <td class='line'>118</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l118s0'>    }</pre></td>
    </tr>
    <tr><td class='line'></td><td colspan='2'>&nbsp;</td></tr>
    <tr>
      <td class='line'></td><td>&nbsp;</td>
      <td class='comment' onclick='showHideLines(this)'><div>    /**
     * @Deprecated use {@link #setSearcherMaxSeekCount(int)} instead
     */</div><span>    /*...*/</span></td>
    </tr>
    <tr>
      <td class='line'>123</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    @Deprecated</pre></td>
    </tr>
    <tr>
      <td class='line'>124</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    public void setSearcher_max_seek_count(int searcherMaxSeekCount) {</pre></td>
    </tr>
    <tr>
      <td class='line'>125</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l125s0'>        setSearcherMaxSeekCount(searcherMaxSeekCount);</pre></td>
    </tr>
    <tr>
      <td class='line'>126</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l126s0'>    }</pre></td>
    </tr>
    <tr><td class='line'></td><td colspan='2'>&nbsp;</td></tr>
    <tr>
      <td class='line'>128</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    @Deprecated</pre></td>
    </tr>
    <tr>
      <td class='line'>129</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    public void setSearcherMaxSeekCount(int searcherMaxSeekCount) {</pre></td>
    </tr>
    <tr>
      <td class='line'>130</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l130s0'>        clientConfig.getPgConfig().setSearcherMaxSeekCount(searcherMaxSeekCount);</pre></td>
    </tr>
    <tr>
      <td class='line'>131</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l131s0'>    }</pre></td>
    </tr>
    <tr><td class='line'></td><td colspan='2'>&nbsp;</td></tr>
    <tr>
      <td class='line'></td><td>&nbsp;</td>
      <td class='comment' onclick='showHideLines(this)'><div>    /**
     * 指定VipServer中使用的cluster 若不指定，将使用默认值 {@link IGraphClientConfig#DEFAULT_CLUSTER}
     *
     * @param searchCluster
     * @Deprecated use {@link #setSearchCluster(String)} instead
     */</div><span>    /*...*/</span></td>
    </tr>
    <tr>
      <td class='line'>139</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    @Deprecated</pre></td>
    </tr>
    <tr>
      <td class='line'>140</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    public void setCluster(String searchCluster) {</pre></td>
    </tr>
    <tr>
      <td class='line'>141</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l141s0'>        setSearchCluster(searchCluster);</pre></td>
    </tr>
    <tr>
      <td class='line'>142</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l142s0'>    }</pre></td>
    </tr>
    <tr><td class='line'></td><td colspan='2'>&nbsp;</td></tr>
    <tr>
      <td class='line'>144</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    public void setSearchCluster(String searchCluster) {</pre></td>
    </tr>
    <tr>
      <td class='line'>145</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l145s0'>        clientConfig.setSearchCluster(searchCluster);</pre></td>
    </tr>
    <tr>
      <td class='line'>146</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l146s0'>    }</pre></td>
    </tr>
    <tr><td class='line'></td><td colspan='2'>&nbsp;</td></tr>
    <tr>
      <td class='line'>148</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    public void setUpdateCluster(String updateCluster) {</pre></td>
    </tr>
    <tr>
      <td class='line'>149</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l149s0'>        clientConfig.setUpdateCluster(updateCluster);</pre></td>
    </tr>
    <tr>
      <td class='line'>150</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l150s0'>    }</pre></td>
    </tr>
    <tr><td class='line'></td><td colspan='2'>&nbsp;</td></tr>
    <tr>
      <td class='line'>152</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    public void setTraceInHeader(boolean flag) {</pre></td>
    </tr>
    <tr>
      <td class='line'>153</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l153s0'>        clientConfig.setTraceInheader(flag);</pre></td>
    </tr>
    <tr>
      <td class='line'>154</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l154s0'>    }</pre></td>
    </tr>
    <tr><td class='line'></td><td colspan='2'>&nbsp;</td></tr>
    <tr>
      <td class='line'>156</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    private boolean isDaily(String searchDomain) {</pre></td>
    </tr>
    <tr>
      <td class='line'>157</td><td class='count'>1</td>
      <td><pre class='prettyprint jmp'>        <span id='l157s0' title='Executions: 1' class='covered'>return searchDomain.contains("daily")</span> || <span id='l157s1' title='Executions: 0' class='uncovered'>searchDomain.contains("local");</span></pre></td>
    </tr>
    <tr>
      <td class='line'>158</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    }</pre></td>
    </tr>
    <tr><td class='line'></td><td colspan='2'>&nbsp;</td></tr>
    <tr>
      <td class='line'>160</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    private String getSearchDomain(String searchDomain) {</pre></td>
    </tr>
    <tr>
      <td class='line'>161</td><td class='count'>1</td>
      <td><pre class='prettyprint jmp'>        <span id='l161s0' title='Executions: 1' class='covered'>if (searchDomain != null</span> && <span id='l161s1' title='Executions: 0' class='uncovered'>!searchDomain.isEmpty())</span> { // 若用户已经制定了domain，则不从Diamond中获取</pre></td>
    </tr>
    <tr>
      <td class='line'>162</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l162s0'>            return searchDomain;</pre></td>
    </tr>
    <tr>
      <td class='line'>163</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>        }</pre></td>
    </tr>
    <tr>
      <td class='line'>164</td><td class='count'>1</td>
      <td><pre class='prettyprint covered' id='l164s0'>        return getDomainFromDiamond(DiamondConfigManager.DATA_ID, DiamondConfigManager.VIP_SEARCH_GROUP,</pre></td>
    </tr>
    <tr>
      <td class='line'>165</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>                DiamondConfigManager.GET_CONFIG_TIMEOUT_MS);</pre></td>
    </tr>
    <tr>
      <td class='line'>166</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    }</pre></td>
    </tr>
    <tr><td class='line'></td><td colspan='2'>&nbsp;</td></tr>
    <tr>
      <td class='line'>168</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    private String getUpdateDomain(String updateDomain) {</pre></td>
    </tr>
    <tr>
      <td class='line'>169</td><td class='count'>1</td>
      <td><pre class='prettyprint jmp'>        <span id='l169s0' title='Executions: 1' class='covered'>if (updateDomain != null</span> && <span id='l169s1' title='Executions: 0' class='uncovered'>!updateDomain.isEmpty())</span> {  // 若用户已经制定了domain，则不从Diamond中获取</pre></td>
    </tr>
    <tr>
      <td class='line'>170</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l170s0'>            return updateDomain;</pre></td>
    </tr>
    <tr>
      <td class='line'>171</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>        }</pre></td>
    </tr>
    <tr>
      <td class='line'>172</td><td class='count'>1</td>
      <td><pre class='prettyprint covered' id='l172s0'>        return getDomainFromDiamond(DiamondConfigManager.DATA_ID, DiamondConfigManager.VIP_UPDATE_GROUP,</pre></td>
    </tr>
    <tr>
      <td class='line'>173</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>                DiamondConfigManager.GET_CONFIG_TIMEOUT_MS);</pre></td>
    </tr>
    <tr>
      <td class='line'>174</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    }</pre></td>
    </tr>
    <tr><td class='line'></td><td colspan='2'>&nbsp;</td></tr>
    <tr>
      <td class='line'>176</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    private String getDomainFromDiamond(String dataId, String group, long timeout) {</pre></td>
    </tr>
    <tr>
      <td class='line'>177</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>        String searchDomain;</pre></td>
    </tr>
    <tr>
      <td class='line'>178</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>        try {</pre></td>
    </tr>
    <tr>
      <td class='line'>179</td><td class='count'>2</td>
      <td><pre class='prettyprint covered' id='l179s0'>            searchDomain = Diamond.getConfig(dataId, group, timeout);</pre></td>
    </tr>
    <tr>
      <td class='line'>180</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l180s0'>        } catch (IOException e) {</pre></td>
    </tr>
    <tr>
      <td class='line'>181</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l181s0'>            throw new IGraphClientException("Failed to get domain via Diamond, with dataId:[" + dataId + "], group:["</pre></td>
    </tr>
    <tr>
      <td class='line'>182</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>                    + group + "], timeout:[" + timeout + "]");</pre></td>
    </tr>
    <tr>
      <td class='line'>183</td><td class='count'>2</td>
      <td><pre class='prettyprint covered' id='l183s0'>        }</pre></td>
    </tr>
    <tr>
      <td class='line'>184</td><td class='count'>2</td>
      <td><pre class='prettyprint jmp'>        <span id='l184s0' title='Executions: 2' class='covered'>if (searchDomain == null</span> || <span id='l184s1' title='Executions: 2' class='covered'>searchDomain.isEmpty())</span> {</pre></td>
    </tr>
    <tr>
      <td class='line'>185</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l185s0'>            throw new IGraphClientException("searchDomain on diamond is empty or null");</pre></td>
    </tr>
    <tr>
      <td class='line'>186</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>        }</pre></td>
    </tr>
    <tr>
      <td class='line'>187</td><td class='count'>2</td>
      <td><pre class='prettyprint covered' id='l187s0'>        return searchDomain;</pre></td>
    </tr>
    <tr>
      <td class='line'>188</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    }</pre></td>
    </tr>
    <tr><td class='line'></td><td colspan='2'>&nbsp;</td></tr>
    <tr>
      <td class='line'>190</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    private IGraphClient buildImpl(String src, String searchDomain, String updateDomain) {</pre></td>
    </tr>
    <tr>
      <td class='line'>191</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>        try {</pre></td>
    </tr>
    <tr>
      <td class='line'>192</td><td class='count'>1</td>
      <td><pre class='prettyprint covered' id='l192s0'>            searchDomain = getSearchDomain(searchDomain);</pre></td>
    </tr>
    <tr>
      <td class='line'>193</td><td class='count'>1</td>
      <td><pre class='prettyprint covered' id='l193s0'>            updateDomain = getUpdateDomain(updateDomain);</pre></td>
    </tr>
    <tr>
      <td class='line'>194</td><td class='count'>1</td>
      <td><pre class='prettyprint covered' id='l194s0'>            boolean isDaily = isDaily(searchDomain);</pre></td>
    </tr>
    <tr><td class='line'></td><td colspan='2'>&nbsp;</td></tr>
    <tr>
      <td class='line'>196</td><td class='count'>1</td>
      <td><pre class='prettyprint jmp'>            <span id='l196s0' title='Executions: 1' class='covered'>if (isRequesterInitialized.compareAndSet(false, true))</span> { // 每个builder仅执行一次searcher的初始化</pre></td>
    </tr>
    <tr>
      <td class='line'>197</td><td class='count'>1</td>
      <td><pre class='prettyprint covered' id='l197s0'>                requester.init(requesterConfig);</pre></td>
    </tr>
    <tr>
      <td class='line'>198</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>            }</pre></td>
    </tr>
    <tr>
      <td class='line'>199</td><td class='count'>1</td>
      <td><pre class='prettyprint covered' id='l199s0'>            IGraphClientConfig thisClientConfig = new IGraphClientConfig(clientConfig); // make copy of clientConfig</pre></td>
    </tr>
    <tr>
      <td class='line'>200</td><td class='count'>1</td>
      <td><pre class='prettyprint covered' id='l200s0'>            thisClientConfig.setSrc(src);</pre></td>
    </tr>
    <tr>
      <td class='line'>201</td><td class='count'>1</td>
      <td><pre class='prettyprint covered' id='l201s0'>            thisClientConfig.setDaily(isDaily);</pre></td>
    </tr>
    <tr>
      <td class='line'>202</td><td class='count'>1</td>
      <td><pre class='prettyprint covered' id='l202s0'>            thisClientConfig.setSearchDomain(searchDomain);</pre></td>
    </tr>
    <tr>
      <td class='line'>203</td><td class='count'>1</td>
      <td><pre class='prettyprint covered' id='l203s0'>            thisClientConfig.setUpdateDomain(updateDomain);</pre></td>
    </tr>
    <tr>
      <td class='line'>204</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>            String localAddress;</pre></td>
    </tr>
    <tr>
      <td class='line'>205</td><td class='count'>1</td>
      <td><pre class='prettyprint covered' id='l205s0'>            localAddress = getIntranetIp();</pre></td>
    </tr>
    <tr>
      <td class='line'>206</td><td class='count'>1</td>
      <td><pre class='prettyprint covered' id='l206s0'>            thisClientConfig.setLocalAddress(localAddress);</pre></td>
    </tr>
    <tr>
      <td class='line'>207</td><td class='count'>1</td>
      <td><pre class='prettyprint covered' id='l207s0'>            return new IGraphClient(thisClientConfig, requester);</pre></td>
    </tr>
    <tr>
      <td class='line'>208</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l208s0'>        } catch (Exception e) {</pre></td>
    </tr>
    <tr>
      <td class='line'>209</td><td class='count'>0</td>
      <td><pre class='prettyprint uncovered' id='l209s0'>            throw new IGraphClientException("Failed to build IGraphClient", e);</pre></td>
    </tr>
    <tr>
      <td class='line'>210</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>        }</pre></td>
    </tr>
    <tr>
      <td class='line'>211</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>    }</pre></td>
    </tr>
    <tr>
      <td class='line'>212</td><td>&nbsp;</td>
      <td><pre class='prettyprint'>}</pre></td>
    </tr>
  </table>
</body>
</html>
